#include "util.hh"
#include <iostream>
#include <vector>

using namespace std;

static bool month_30_days(int month) {
    switch (month)
    {
    case 4:
    case 6:
    case 9:
    case 11:
        return true;
    default:
        return false;
    }
}

static vector<pair<unsigned, unsigned>> fill() {
    vector<pair<unsigned, unsigned>> r;
    unsigned weekday = 2;
    unsigned year = 1901;
    unsigned month = 1;
    unsigned day = 1;
    while (year < 2001) {
        unsigned first = weekday % 7;
        unsigned second = day;
        r.push_back(make_pair(first, second));
        // if (first == 0 && second == 1)
            // cout << first << ':' << year << '-' << month << '-' << day << endl;
        ++weekday;

        ++day;
        if (day == 29 && month == 2 && !leap_year(year)) {
            day = 1;
            month = 3;
        } else if (day == 30 && month == 2 && leap_year(year)) {
            day = 1;
            month = 3;
        } else if (day == 31 && month_30_days(month)) {
            day = 1;
            ++month;
        } else if (day == 32) {
            day = 1;
            ++month;
            if (month == 13) {
                month = 1;
                ++year;
            }
        }
    }
    return r;
}
 
int main() {
    auto vp = fill();
    unsigned count = 0;
    for (auto& p : vp) {
        if (p.first == 0 && p.second == 1)
            ++count;
    }
    cout << count << endl; // 171
}